package com.socket.controller;

import org.springframework.web.bind.annotation.*;

import java.time.Instant;
import java.util.Map;

@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping("/demo01")
    public String demo01() {
        return "这是一个demo01--" + Instant.now().getEpochSecond();
    }

    @GetMapping("/demo02/{msg}")
    public String demo02(@PathVariable("msg") String msg) {
        return "这是一个demo02--" + msg;
    }

    @GetMapping("/demo03")
    public String demo03(@RequestParam String msg) {
        return "这是一个demo03--" + msg;
    }

    @PostMapping("/demo04")
    public String demo04(@RequestBody Map<String, Object> param) {
        return "这是一个demo04--" + param.get("msg");
    }

}
